Skip to content

grt/cugr: improve via demand calculation#10802

Open
eder-matheus wants to merge 18 commits into
The-OpenROAD-Project:masterfrom
eder-matheus:grt_cugr_vias
Open

grt/cugr: improve via demand calculation#10802
eder-matheus wants to merge 18 commits into
The-OpenROAD-Project:masterfrom
eder-matheus:grt_cugr_vias

Conversation

@eder-matheus

@eder-matheus eder-matheus commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary

CUGR previously modeled a via's global-routing demand as a min-area-derived stub length inflated by a flat via_multiplier = 2.0 — a proxy with no perpendicular (track-blocking) term. This replaces it with a model built from the via's real enclosure geometry read from the tech:

demand = (enclosure_along / gcell) * ceil((enclosure_perp + 2*spacing) / pitch)

i.e. "what fraction of a track's length the pad spans" times "how many whole tracks it blocks across" (a via cannot partially block a track, so the perpendicular term is rounded up). This removes the magic via_multiplier on the geometry path and better approximates the resource a via consumes at detailed routing. The via geometry is extracted once in Design; GridGraph consumes the digested per-layer demand.

Also included:

  • Via selection ranks candidates (OR_DEFAULT, then fewest cuts, then LEF-default, then smallest enclosure), matching drt's initDefaultVias, instead of relying on ODB declaration order.
  • A via with several rects on one routing layer has its enclosure boxes unioned, so the full footprint is charged.
  • Spacing falls back to the parallel-run-length value when the plain spacing rule is 0 (advanced techs), so the perpendicular term is not silently dropped.
  • Warns (GRT-173) when a layer pair has no via and the legacy min-area proxy is used as a fallback.

Type of Change

  • New feature
  • Refactoring

Impact

Affects CUGR only (global_route -use_cugr); the default FastRoute path is unchanged. Via-demand magnitudes change per layer, which shifts CUGR routing, congestion, and guides: neutral on uncongested designs, improved on congested designs (lower reported overflow and wirelength, e.g. congested sky130hs/gcd variants 58->35 and 101->58 overflow with shorter wirelength), and higher reported congestion on an extreme 90%-capacity stress test (the model charging fat upper-metal vias under starvation; RRR still converges). Resistance-aware timing is preserved. A new warning (GRT-173) is emitted for techs with no via for a routing-layer pair. All CUGR test goldens were regenerated.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have included tests to prevent regressions.
  • I have signed my commits (DCO).

Related Issues

N/A

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…op dead field

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…er default

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…king

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
@github-actions github-actions Bot added the size/M label Jul 3, 2026
@eder-matheus

Copy link
Copy Markdown
Member Author

@codex review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba01782fdc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/grt/src/cugr/src/Design.cpp Outdated
Comment on lines +418 to +422
lo_dx = r.dx();
lo_dy = r.dy();
} else if (box->getTechLayer() == upper_tl) {
up_dx = r.dx();
up_dy = r.dy();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accumulate via metal extents across all boxes

When the selected tech via has more than one RECT on a routing layer, this loop overwrites lo_dx/lo_dy or up_dx/up_dy with whichever dbBox is visited last. That makes the new via-demand model charge a single rectangle rather than the via's full routing-layer footprint, so compound/default vias can have congestion and cost under-reported in a way that depends on box order. Please union/accumulate the routing-layer bbox before calling viaDemandLength.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would support such a non-standard via.

@maliberty

Copy link
Copy Markdown
Member

(perp + 2 * spacing) / pitch

Do you want to use ceil? You can't really partially block a track.

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
@eder-matheus

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63bd0c554a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/grt/src/cugr/src/Design.cpp Outdated
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
…ulti-cut

Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
@eder-matheus eder-matheus marked this pull request as ready for review July 6, 2026 17:53
@eder-matheus eder-matheus requested a review from a team as a code owner July 6, 2026 17:53
@eder-matheus eder-matheus requested a review from jfgava July 6, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants